#!/bin/bash

a=(`cat 1.txt`)
b=(`cat 2.txt`)

for i in ${!a[@]} 
do
	for j in ${!b[@]}
	do
		if [[ ${a[i]} == ${b[j]} ]];then
			echo "${a[i]}" 
		fi
	done
done

